import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';

/**
 * Generated class for the NewsDetailPage page.
 *
 * See http://ionicframework.com/docs/components/#navigation for more info
 * on Ionic pages and navigation.
 */
@IonicPage()
@Component({
  selector: 'page-news-detail',
  templateUrl: 'news-detail.html',
})
export class NewsDetailPage {

    news_source: string;
    news_title: string;
    news_contents: string[] = [];

  constructor(public navCtrl: NavController, public navParams: NavParams) {
      this.news_source = this.navParams.get('source');
      this.news_title = this.navParams.get('title');
      let contentArray  = this.navParams.get('content');
      for (let i = 0; i < contentArray.length; i++) {
          let content = contentArray[i];
          if (typeof content == 'string') {
              this.news_contents.push(content);
          }
      }
      console.log(this.news_contents);
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad NewsDetailPage');
  }

}
